﻿using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;

namespace Reece.Open.Mvc
{
    public class FormsAuthenticationWrapper : IFormsAuthentication
    {
        public string CookieDomain { get { return FormsAuthentication.CookieDomain; } }
        public HttpCookieMode CookieMode { get { return FormsAuthentication.CookieMode; } }
        public bool CookiesSupported { get { return FormsAuthentication.CookiesSupported; } }
        public string DefaultUrl { get { return FormsAuthentication.DefaultUrl; } }
        public bool EnableCrossAppRedirects { get { return FormsAuthentication.EnableCrossAppRedirects; } }
        public string FormsCookieName { get { return FormsAuthentication.FormsCookieName; } }
        public string FormsCookiePath { get { return FormsAuthentication.FormsCookiePath; } }
        public bool IsEnabled { get { return FormsAuthentication.IsEnabled; } }
        public string LoginUrl { get { return FormsAuthentication.LoginUrl; } }
        public bool RequireSSL { get { return FormsAuthentication.RequireSSL; } }
        public bool SlidingExpiration { get { return FormsAuthentication.SlidingExpiration; } }
        public TicketCompatibilityMode TicketCompatibilityMode { get { return FormsAuthentication.TicketCompatibilityMode; } }
        public TimeSpan Timeout { get { return FormsAuthentication.Timeout; } }

        public bool Authenticate(string name, string password)
        {
            return FormsAuthentication.Authenticate(name, password);
        }

        public FormsAuthenticationTicket Decrypt(string encryptedTicket)
        {
            return FormsAuthentication.Decrypt(encryptedTicket);
        }

        public void EnableFormsAuthentication(NameValueCollection configurationData)
        {
            FormsAuthentication.EnableFormsAuthentication(configurationData);
        }

        public string Encrypt(FormsAuthenticationTicket ticket)
        {
            return FormsAuthentication.Encrypt(ticket);
        }

        public HttpCookie GetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath)
        {
            return FormsAuthentication.GetAuthCookie(userName, createPersistentCookie, strCookiePath);
        }

        public HttpCookie GetAuthCookie(string userName, bool createPersistentCookie)
        {
            return FormsAuthentication.GetAuthCookie(userName, createPersistentCookie);
        }

        public string GetRedirectUrl(string userName, bool createPersistentCookie)
        {
            return FormsAuthentication.GetRedirectUrl(userName, createPersistentCookie);
        }

        public string HashPasswordForStoringInConfigFile(string password, string passwordFormat)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, passwordFormat);
        }

        public void Initialize()
        {
            FormsAuthentication.Initialize();
        }

        public void RedirectFromLoginPage(string userName, bool createPersistentCookie, string strCookiePath)
        {
            FormsAuthentication.RedirectFromLoginPage(userName, createPersistentCookie, strCookiePath);
        }

        public void RedirectFromLoginPage(string userName, bool createPersistentCookie)
        {
            FormsAuthentication.RedirectFromLoginPage(userName, createPersistentCookie);
        }

        public void RedirectToLoginPage(string extraQueryString)
        {
            FormsAuthentication.RedirectToLoginPage(extraQueryString);
        }

        public void RedirectToLoginPage()
        {
            FormsAuthentication.RedirectToLoginPage();
        }

        public FormsAuthenticationTicket RenewTicketIfOld(FormsAuthenticationTicket tOld)
        {
            return FormsAuthentication.RenewTicketIfOld(tOld);
        }

        public void SetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath)
        {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie, strCookiePath);
        }

        public void SetAuthCookie(string userName, bool createPersistentCookie)
        {
            FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
        }

        public void SignOut()
        {
            FormsAuthentication.SignOut();
        }
    }
}
